home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / EnterAct 3.5 / Drag_on Modules / hAWK programs / $MA7_RunClip < prev    next >
Encoding:
Text File  |  1993-04-09  |  3.1 KB  |  72 lines  |  [TEXT/KEEN]

  1. # $MA7_RunClip : takes the actual hAWK program to be  run  from  the  system
  2. # clipboard, and runs it on the list of files  specified  in  "$tempStdOut".
  3. # Intended mainly for use with Minimal App7.
  4. # NOTE this program does NOT allow you to set variables, so it  should  only
  5. # be used to run hAWK programs  that  do  not  require  preset  variables—or
  6. # programs which will run to your satisfaction with all preset variables set
  7. # to zero or the null string. For example, "$CompareFiles" has a  couple  of
  8. # preset variables, but will normally work fine without setting them.
  9. # To run this program using Minimal App7:
  10. # 1 Using your favorite editor, create a list of full path names
  11. #     for your desired input files, and put the list in "$tempStdOut".
  12. #     This can easily be done by running "$EchoFullPathNames".
  13. # 2 Again using your favorite editor, Open and Copy the entire hAWK
  14. #     program you wish to run.
  15. # 3 Switch to Minimal App7, call up hAWK, and select this program
  16. #     (ie "$MA7_RunClip").
  17. # 4 If this is your FIRST RUN of "$MA7_RunClip", use the "Take input
  18. #     from" popup to select "$tempStdOut" as the specific input
  19. #     file. Then click the "Save settings" button. This needs to be
  20. #     done the first time only.
  21. # 5 Click the Run button, and then switch out to another application
  22. #     if you wish. Minimal App7 will notify you when it is done.
  23. # 6 Results of the run will be in the usual place (typically "$tempStdOut").
  24. # Note technically you could use some other file  besides  "$tempStdOut"  to
  25. # hold the list of files, but  since  "$EchoFullPathNames"  sends  the  list
  26. # there, this is the easiest way. If you have a fixed  list  of  files,  you
  27. # could use a dedicated file for this list  -  just  put  the  list  in  the
  28. # dedicated file before running this program, and change the specific  input
  29. # file this program uses to the dedicated file.
  30.  
  31. # User’s Manual references:
  32. # «hAWK User’s Manual» «F   Running hAWK programs»
  33. # «hAWK User’s Manual» «L  5   Regular expressions»
  34. # «hAWK User’s Manual» «M  5   Built-in string and file functions»
  35. # «hAWK User’s Manual» «K  4   Built-in variables»
  36. # «hAWK User’s Manual» «K  8   Arrays»
  37. # «hAWK User’s Manual» «N   User-defined functions»
  38. # «hAWK User’s Manual» «P  3   The getline function»
  39. # «hAWK User’s Manual» «O  3   Output into files»
  40. # «hAWK User’s Manual» «Q   The hAWK function»
  41.  
  42.  
  43. #This is the modification to be added to the beginning of any program
  44. #that wants a list of files in specific order to use as input:
  45. BEGIN    {while (getline _specific_file_ < ARGV[1] > 0)
  46.             {
  47.             if (length(_specific_file_) > 1 &&
  48.             index(_specific_file_, ":") > 0)
  49.                 ARGV[ARGC++] = _specific_file_;
  50.             }
  51.         close(ARGV[1]);
  52.         ARGV[1] = "";
  53.         }
  54. #end modification
  55.  
  56. # Print the clip to a temporary file, and run it as a hAWK program
  57. # on the list of files provided in the file ARGV[1].
  58. BEGIN {
  59.     progFile = STDPATH "Drag_on Modules:hAWK programs:$hAWKTempProgram"
  60.     print getclip() > progFile
  61.     close(progFile)
  62.     argv[x++] = "hAWK"
  63.     argv[x++] = "-f" progFile
  64.     argv[x++] = "--"
  65.     for (j = 2; j < ARGC; ++j) # Note ARGV[1] was nulled out above.
  66.         argv[x++] = ARGV[j]
  67.     hAWK(argv)
  68.     }
  69.